package com.caiyigo.test.Thread;

public class Calculator implements Runnable {
	private int number;

	@Override
	public void run() {
		for (int i = 0; i <= 10; i++) {
			System.out.printf("%s:%d*%d=%d\n",
					Thread.currentThread().getName(), number, i, i * number);
		}
	}

	public Calculator(int number) {
		this.number = number;
	}

	public static void main(String[] args) throws InterruptedException {
		for (int i = 0; i <= 10; i++) {
			Calculator calculator = new Calculator(i);
			Thread thread = new Thread(calculator);
			thread.start();
			System.out.println("-----------");
			thread.join();
		}
	}

}
